package si.assign1.model;

import java.io.Serializable;
import java.sql.Clob;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name="product_type_attribute_values")
@NamedQueries({
    @NamedQuery(name="listProductTypeAttributeValues",
                query="SELECT ptav FROM ProductTypeAttributeValue ptav"),
    @NamedQuery(name="getProductTypeAttributeValueById",
                query="SELECT ptav FROM ProductTypeAttributeValue ptav WHERE ptav.id = :id"),
})
public class ProductTypeAttributeValue 
{
	public ProductTypeAttributeValue(){}

	/*
	 * Properties
	 */
	
	/*
	 * Set and get id
	 */
	public int getId()
	{  return id;   }
	public void setId(int id)
	{  this.id = id; }
	
	/*
	 * Set and get product_id
	 */
	public Product getProduct()
	{  return product;  }
	public void setProduct(Product product) {  
		this.product = product;
	}
	
	/*
	 * Set and get product_type_attribute_id
	 */
	public ProductTypeAttribute getProductTypeAttribute()
	{	return productTypeAttribute;   }
	public void setProductTypeAttribute(ProductTypeAttribute productTypeAttribute) {   
		this.productTypeAttribute = productTypeAttribute;
	}
	
	/*
	 * Set and get value
	 */
	public String getValue()
	{	return value;  }
	public void setValue(String value)
	{   this.value = value; }
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(optional=false)
	@Column(name="id", nullable=false)
	private int id;

	@Lob
	@Column(name="value", nullable=true)
	private String value;
	
	/*
	 * Many-to-one mapping from ProductTypeAttributeValue to ProductTypeAttribute  
	 */
	@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
	@JoinColumn(name="product_type_attribute_id", nullable=false)
	private ProductTypeAttribute productTypeAttribute;
	
	/*
	 * Many-to-one mapping from ProductTypeAttributeValue to Product 
	 */
	@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
	@JoinColumn(name="product_id", nullable=false)
	private Product product;
	
}
